package com.czk;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/4/19 21:58
 */
@Configuration
@ConditionalOnWebApplication
@EnableConfigurationProperties(MyProperties.class)
public class MyAutoConfiguration {
    @Autowired
    private MyProperties myProperties;
    @Bean
    public NzqService nzqService(){
        // 创建对象
        NzqService nzqService=new NzqService();
        // 设置配置属性
        nzqService.setProperties(myProperties);
        // 返回对象
        return nzqService;
    }
}
